package com.whiteseason.whitebot.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "user")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    @Id
    private String userId;
    @Column(name = "qq",nullable = false)
    private String qq;
    @Column(name = "pp_raw")
    private String ppRaw;
    @Column(name = "accuracy")
    private String accuracy;
    @Column(name = "pp_rank")
    private String ppRank;
    @Column(name = "pp_country_rank")
    private String ppCountryRank;
    @Column(name = "play_Count")
    private String playCount;
    @Column(name = "total_hit")
    private String totalHit;

    //根据api获取的userinfo生成user类
    public User(UserInfo userInfo,String qq){
        this.qq = qq;
        this.userId = userInfo.getUser_id();
        this.ppRaw = userInfo.getPp_raw();
        this.accuracy = userInfo.getAccuracy();
        this.ppRank = userInfo.getPp_rank();
        this.ppCountryRank = userInfo.getPp_country_rank();
        this.playCount = userInfo.getPlaycount();
        this.totalHit = Long.toString(Long.parseLong(userInfo.getCount300())
                +Long.parseLong(userInfo.getCount100())+Long.parseLong(userInfo.getCount50()));
    }
}
